package com.woniu.dao;

import com.woniu.pojo.CommunityFavor;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommunityFavorMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(CommunityFavor record);

    int insertSelective(CommunityFavor record);

    CommunityFavor selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(CommunityFavor record);

    int updateByPrimaryKey(CommunityFavor record);

    @Select(value = "select * from community_favor where cf_dynamic_id = #{dynamicId} order by cf_createTime desc limit 7")
    List<CommunityFavor> selectById(Integer dynamicId);

    @Select(value = "delete from community_favor where cf_dynamic_id=#{dynamicId} and cf_user_id=#{userId}")
    void deleteFavorById(Integer dynamicId, Integer userId);

    @Select(value = "select cf_dynamic_id from community_favor where cf_user_id = #{userId} ")
    List<Integer> selectIdByUserId(Integer userId);

    @Select(value = "select count(id) from community_favor where cf_dynamic_id = #{id}")
    Integer selectCountById(Integer id);
}